home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0091_Disk Structure-FAT Table?.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  2KB  |  62 lines

  1. {
  2. -> I am searching for information on how to access the Fat table and
  3. -> boot sectors through Turbo Pascal v6.0.  If anyone knows a book that
  4. -> could point me in the right direction, or would be willing to share
  5. -> some knowledge with me I'd appreciate it. Thanx.
  6.  
  7. Here's some source to help you out:
  8. }
  9.  
  10. (*** BEGINS HERE ***)
  11. (***********************************************************************
  12. ***
  13. *   This is a simple source to demonstrate how to read the File
  14. Allocation
  15.    Table (FAT) and get some information on the current drive.  This was
  16.    written by David Mart, using TP7.0
  17.    NOTE: DOS 2.0 or higher is required.
  18.  
  19.    If you have any questions, you can contact me by calling Programmers
  20.    Online Systems at 416-512-1928 or simply send me a netmail via
  21. FidoNet
  22.    to: 1:250/738.
  23. ************************************************************************
  24. **)
  25.  
  26. Program ReadFAT;
  27. Uses DOS,CRT;
  28. Var
  29.   MyRegs   : Registers;
  30.   ClusterSize : Real;
  31.   DiskSize    : Real;
  32.  
  33. Begin
  34.   LowVideo;
  35.   ClrScr;
  36.  
  37.   Fillchar (MyRegs, sizeof(Registers), 00);
  38.   MyRegs.AH := $30;
  39.   MyRegs.DS := DSeg;
  40.   MsDOS (MyRegs);
  41.   Fillchar (MyRegs, sizeof(Registers), 00);
  42.   MyRegs.AH := $1B;
  43.   MyRegs.DS := DSeg;
  44.   MsDOS (MyRegs);
  45.   WriteLn;
  46.   WriteLn ('Information for current drive: ');
  47.   WriteLn;
  48.  
  49.   With MyRegs Do
  50.        Begin
  51.          WriteLn ('Clusters on disk    : ', DX);
  52.          WriteLn ('Sectors p/Cluster   : ', AL);
  53.          WriteLn ('Sector Size (Bytes) : ', CX);
  54.          WriteLn;
  55.          ClusterSize := (AL * CX);
  56.          DiskSize    := (ClusterSize * DX);
  57.          WriteLn ('Cluster Size (Bytes): ', Round(ClusterSize));
  58.          WriteLn ('Disk Space (Bytes)  : ', Round(DiskSize));
  59.        End;
  60. End.
  61.  
  62.